package com.wq.httpclientcore.entities.req.save;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * @author wangqi
 * @since 2025-03-13 10:46:59
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "鉴权配置")
public class AuthConfigSaveREQ implements Serializable {
    @Schema(description = "记录的唯一标识符，自增主键")
    private Long id;

    @Schema(description = "认证配置的名称，用于标识该配置")
    private String name;

    @Schema(description = "认证请求的目标 URL")
    private String authUrl;

    @Schema(description = "认证请求使用的 HTTP 方法，如 GET、POST 等")
    private String authMethod;

    @Schema(description = "认证请求的查询参数，以 JSONB 格式存储")
    private String authRequestParams;

    @Schema(description = "认证请求的 HTTP 头信息，以 JSONB 格式存储")
    private String authRequestHeaders;

    @Schema(description = "认证请求的请求体，以 JSONB 格式存储")
    private String authRequestBody;

    @Schema(description = "认证响应的映射规则，以文本形式存储")
    private String authResponseMapping;

    @Schema(description = "认证头信息的映射规则，以文本形式存储")
    private String authHeaderMapping;

    @Schema(description = "记录的创建时间，默认值为当前时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createdAt;

    @Schema(description = "记录的更新时间，默认值为当前时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updatedAt;

}
